package com.heima.wemedia.util;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/2/1 9:53
 * @Version 1.0
 */
public class WmMediaThreadLocalUtil {

    private final static ThreadLocal<WmUser> USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 设置用户
     * @param user
     */
    public static void setUser(WmUser user){
        USER_THREAD_LOCAL.set(user);
    }

    public static WmUser getUser(){
        return USER_THREAD_LOCAL.get();
    }

    public static void clear(){
        USER_THREAD_LOCAL.remove();
    }

}